package com.feishi.core.util.jna;

import com.sun.jna.Library;
import com.sun.jna.Native;

/**
 * @version 1.0
 * @auth caixq
 * @time 18-4-20 16:40
 **/
public class JnaUtil {
    public static <T extends Library>  T  loadJna(String soPath, Class<T> clasz){
//        System.out.println(Thread.currentThread().getContextClassLoader().getResource(soPath).getPath());
        if(soPath.startsWith("/")){
            soPath=soPath.substring(1);
        }

        return  (T)Native.loadLibrary(Thread.currentThread().getContextClassLoader().getResource(soPath).getPath(),clasz);
    }
}
